package com.kaisu.blog.domain.blog;

import com.kaisu.blog.common.util.IdUtils;
import com.kaisu.blog.domain.user.User;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author kaisu
 */
@Data
public class Comment {
    /**
     * id
     */
    private String id;
    /**
     * 内容
     */
    private String content;
    /**
     * 发送人
     */
    private User sendUser;
    /**
     * 发送时间
     */
    private LocalDateTime sendTime;

    public static Comment create(String content, User user) {
        Comment comment = new Comment();
        comment.setId(IdUtils.generateId());
        comment.setContent(content);
        comment.setSendTime(LocalDateTime.now());
        comment.setSendUser(user);
        return comment;
    }
}
